feat(db): partition collab update batches#365
Merged
Conversation
Collaborative update batches can grow quickly and need document-local partitioning before cold archiving. Add PostgreSQL schema initialization for a 16-way document_id hash partitioned collab batch table and migrate existing rows into the partitioned target. The batch table primary key now includes document_id so PostgreSQL partition constraints remain valid.
The collaborative batch partitioning schema needs regression coverage around PostgreSQL partition constraints. Add DB tests for the partition-compatible primary key, hash partition DDL, and collab batch partition definition. The checks pin the document_id hash partition shape used by schema initialization.
The Phase 4 plan should reflect that collaborative batch hash partitioning now has an implementation entry point. Mark the collab_document_update_batches document_id hash partition item complete and update the status matrix and progress estimate. The remaining Phase 4 work is now cold partition export and archive recovery.
Existing collab batch tables keep their serial sequence name after the table is renamed during partition migration. Rename the legacy-owned id sequence before creating the new partitioned parent so bigserial can create its expected sequence. Startup schema migration now avoids the sequence-name collision on databases with preexisting collab batches.
The collab batch partition migration needs coverage for the serial sequence name left behind by existing tables. Assert that legacy migration SQL finds the owned id sequence and renames it away from the new partitioned parent name. The regression check protects the startup migration from reintroducing the bigserial sequence collision.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature Description
collab_document_update_batchesbydocument_id.Implementation Approach
collab_document_update_batchestable into the partitioned target and syncs the serial sequence after copying rows.document_idand adds DB tests for the partition contract.Testing
golangci-lint runfrombackend/: passed.bash script/ci/backend.sh: passed.Risks